

package com.hazelcast.internal.metrics.impl;

import com.hazelcast.internal.metrics.MetricTarget;
import com.hazelcast.internal.metrics.Probe;
import com.hazelcast.internal.metrics.ProbeLevel;
import com.hazelcast.internal.metrics.ProbeUnit;

/**
 * Class for caching the fields of a {@link Probe} to avoid allocation
 * through reflective access.
 */
final class CachedProbe {
    private final ProbeLevel level;
    private final ProbeUnit unit;
    private final MetricTarget[] excludedTargets;

    CachedProbe(Probe probe) {
        unit = probe.unit();
        level = probe.level();
        excludedTargets = probe.excludedTargets();
    }

    ProbeLevel level() {
        return level;
    }

    ProbeUnit unit() {
        return unit;
    }

    MetricTarget[] excludedTargets() {
        return excludedTargets;
    }
}
